{template header}
<style type="text/css">
    .popup {
        background-color: whitesmoke;
        display: none;
        padding: 10px;
        border: 2px solid #ddd;
        position: fixed;
        top: 50%;
        left: 50%;
        width:250px;
        height:250px;
        z-index: 99999;
    }
    .bg{display:none;position:fixed;width:100%;height:100%;background:#000;z-index:2;top:0;left:0;opacity:0.7;}
</style>
<h4 style="padding-left:10px;;">
    <span>搜索</span>
    <i class="icon-search"></i>
</h4>
<form class="form-horizontal" method="post" action="">
    <div class="control-group search-group" style="margin:0;">
        <label class="control-label" >状态：</label>
        <div class="controls">
            <select name="status">
                <option value="-1">全部</option>
                {loop $status $k $v}
                <option value="{$k}">{$v}</option>
                {/loop}
            </select>
        </div>
    </div>
    <div class="control-group search-group" style="margin:0;">
        <div class="controls">
            <button class="btn" type="submit">提交</button>
            <!-- <button class="btn" type="reset">重置</button> -->
        </div>
    </div>
</form>
<div class="bs-docs-example table-align pt-15" style="clear:both;">
    <table class="table table-striped table-align">
        <thead>
        <tr>
            <th>申诉人</th>
            <th>活动名称</th>
            <th>申诉理由</th>
            <th>申诉图片</th>
            <th>申诉状态</th>
            <th>申诉时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {loop $list $k $v}
        <tr>
            <td>{$v['name']}</td>
            <td>{$v['title']}</td>
            <td>{$v['reason']}</td>
            <td>
                {loop $v['img'] $key $item}
                <a href="{$item}" target="_blank" title="点击查看"><img style="width: 150px;height: 80px" src="{$item}"/></a>
                {/loop}
            </td>
            <td>{$v['s']}</td>
            <td>{eval echo date("Y-m-d H:i:s",$v['addtime'])}</td>
            <td>
                {if $v['status'] == 0}
                <button class="btn btn-primary" onclick="handle({$v['id']},'pass')">通过</button>&nbsp;&nbsp;
                <button class="btn btn-primary" name="{$v['id']}" onclick="layer(this,'refuse')">拒绝</button>
                {/if}
            </td>
            <td>
                <div class="bg" id="bg_{$v['id']}"></div>
                <div class="popup" id="popup_{$v['id']}">
                    <textarea style="width:235px;height: 200px" id="reason_{$v['id']}"></textarea>
                    <div style="text-align: center">
                        <button class="btn btn-primary" onclick="handle({$v['id']})">确定</button>&nbsp;&nbsp;
                        <button class="btn btn-primary" onclick="$('.popup').hide();$('.bg').hide()">取消</button>
                    </div>
                </div>
            </td>
        </tr>

        {/loop}
        <div id="res"></div>
        </tbody>
    </table>

</div>
<div class="pagination">
    <ul>
        {$pageStr}
    </ul>
</div>
{template footer}
<script>
    var act = 'cancel';
    function layer(obj,actName) {
        var id = $(obj).attr('name');
        $("#bg_"+id).show();
        $("#popup_"+id).fadeIn(300);
        act = actName;
        var popMargTop = $("#popup_"+id).height() / 2;
        var popMargLeft = $("#popup_"+id).width() / 2;
        $("#popup_"+id).css({
            'margin-top' : -popMargTop,
            'margin-left' : -popMargLeft
        });
    };
    function handle(id,action){
        if(action != undefined){
            act = action;
        }
        var reason = $("#reason_"+id).val();
        var reqData = {id:id,act:act,reason:reason};
        $.post('?c=admin&a=complain',reqData,function(data){
            alert(data.msg);
            if(data.code==200) window.location.reload();
        },"json")
    }
</script>